import request from '@/utils/request'

// 获取设备列表
export function listMnitor(query) {
  return request({
    url: '/mes/dv/monitor/list',
    method: 'get',
    params: query
  })
}

// 获取设备详情
export function getMnitorDeviceInfo(deviceMonitorId) {
  return request({
    url: '/mes/dv/monitor/' + deviceMonitorId,
    method: 'get',
  })
}

// 获取设备节点
export function getBrowerNodes(deviceMonitorId) {
  return request({
    url: '/mes/dv/monitor/browerNodes/' + deviceMonitorId,
    method: 'get'
  })
}

// 新增设备
export function addMnitor(query) {
  return request({
    url: '/mes/dv/monitor',
    method: 'post',
    data: query
  })
}

// 更新设备
export function putMnitor(query) {
  return request({
    url: '/mes/dv/monitor',
    method: 'put',
    data: query
  })
}

// 获取设备列表
export function delMnitor(deviceMonitorIds) {
  return request({
    url: '/mes/dv/monitor/' + deviceMonitorIds,
    method: 'delete',
  })
}


// ----------------------------------------------------------------

// 获取设备列表/dev-api/ktg-mes/mes/dv/monitorItem/list
export function nodeListMnitor(query) {
  return request({
    url: '/mes/dv/monitorItem/list',
    method: 'get',
    params: query
  })
}

// 获取设备详情
export function getNodeMnitorDeviceInfo(deviceMonitorId) {
  return request({
    url: '/mes/dv/monitorItem/' + deviceMonitorId,
    method: 'get',
  })
}

// 获取设备节点
// export function getBrowerNodes(deviceMonitorId) {
//   return request({
//     url: '/mes/dv/monitor/browerNodes/' + deviceMonitorId,
//     method: 'get'
//   })
// }

// 新增设备
export function addNodeMnitor(query) {
  return request({
    url: '/mes/dv/monitorItem',
    method: 'post',
    data: query
  })
}

// 批量新增设备
export function addMoreNodeMnitor(query) {
  return request({
    url: '/mes/dv/monitorItem/addBatch',
    method: 'post',
    data: query
  })
}

// 更新设备
export function putNodeMnitor(query) {
  return request({
    url: '/mes/dv/monitorItem',
    method: 'put',
    data: query
  })
}

// 获取设备列表
export function delNodeMnitor(deviceMonitorIds) {
  return request({
    url: '/mes/dv/monitorItem/' + deviceMonitorIds,
    method: 'delete',
  })
}

// 获取设备节点值 /dev-api/ktg-mes/mes/dv/monitorItem/queryBatch/{deviceMonitorItemIds}
export function getBatchValues(deviceMonitorId) {
  return request({
    url: '/mes/dv/monitorItem/queryValBatch/' + deviceMonitorId,
    method: 'get',
    timeout: 30000,
  })
}